#ifndef _DOMAIN_
#define _DOMAIN_

#include "Point.h"
#include <cassert>

template <unsigned int DIM>
class Domain
{
public:
    Domain() = default;
    virtual ~Domain() = default;
    Domain(std::vector<Point<DIM>>& pointList) : _PointList{pointList} {};
    virtual void setVertexList(std::vector<Point<2>>& pointList)
    {
        copy(pointList.begin(), pointList.end(), _PointList.begin());
    };
    virtual Point<DIM>& getVertex(int _i)
    {
        return _PointList[_i];
    };

protected: 
    std::vector<Point<DIM>> _PointList;
};

/** 
 *@brief 二维矩形
 */
class Rectangle2D: public Domain<2>
{
public:
	/**
	 * @brief 默认构造函数。
	 *
	 */
	Rectangle2D() = default;
	~Rectangle2D() = default;
	//逆时针顺序
	Rectangle2D(std::vector<Point<2>>& pointList)
		{
			assert(pointList.size() == 4);
			_PointList.resize(pointList.size());
			copy(pointList.begin(),pointList.end(),_PointList.begin());
		};
	virtual void setVertexList(std::vector<Point<2>>& pointList)
	{
        assert(pointList.size() == 4);
		_PointList.resize(pointList.size());
        copy(pointList.begin(),pointList.end(),_PointList.begin());
    };
    virtual Point<2>& getVertex(int _i)
    {
        return _PointList[_i];
    };
};

#else
#endif
